import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:jyofservice/fluro/NavigatorUtil.dart';
import 'package:jyofservice/tongjichaxun/HuaWuBaoBiao.dart';
import 'package:jyofservice/tongjichaxun/LeiXinTongJi.dart';
import 'package:jyofservice/tongjichaxun/RightEndDrawer.dart';
import 'package:jyofservice/tongjichaxun/WeiXiuTongJi.dart';
import 'package:jyofservice/util/SlideRoute.dart';

class TongJiChaXunPage extends StatefulWidget {
  @override
  _TongJiChaXunPageState createState() => _TongJiChaXunPageState();
}

class _TongJiChaXunPageState extends State<TongJiChaXunPage> {

  final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
  List tabs = ['话务员接听统计', '工单处理部门统计','工单处理维修员统计'];

  @override
  Widget build(BuildContext context) {
    return Scaffold(

      key: _scaffoldKey,
      appBar: AppBar(
        centerTitle: true,
        title: Text('统计查询',style: TextStyle(
            color: Colors.white, fontSize: ScreenUtil().setSp(45)),),
        elevation: 0.0,
        leading: IconButton(
            icon: Icon(Icons.arrow_back_ios),
            onPressed: () {
              Navigator.pop(context, false);
            }),
      ),

      body: Container(

        child: ListView.builder(
            itemCount: tabs.length,
            itemBuilder:buildItem ,
          
        ),
      )
    );
  }

  Widget buildItem(BuildContext context,int index) {

     return InkWell(
       onTap: (){

         if(tabs[index]=="话务员接听统计") {
           Navigator.push(context, SlideRoute().createRoute(HuaWuBaoBiaoPage(titleName: tabs[index],)));
         }

         if(tabs[index]=="工单处理部门统计") {
           Navigator.push(context, SlideRoute().createRoute(LeiXinTongJiPage(titleName: tabs[index])));
         }

         if(tabs[index]=="工单处理维修员统计") {
           Navigator.push(context, SlideRoute().createRoute(WeiXiuTongJiPage(titleName: tabs[index])));
         }
       },
       child: Container(

         alignment: Alignment.center,
         height: ScreenUtil().setHeight(160),
         margin: EdgeInsets.fromLTRB(10, 5, 10, 5),
         decoration: BoxDecoration(
           borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setHeight(10))),
           gradient: LinearGradient(
             stops: [0.0, 1.0],
             tileMode: TileMode.repeated,
             begin: Alignment.topLeft,
             end: Alignment.bottomRight, // 10% of the width, so there are ten blinds.
             colors: [Colors.blue,Colors.lightBlue], // whitish to gray
           ),
         ),
         child: Text(tabs[index],style: TextStyle(fontWeight: FontWeight.w600,color: Colors.white),),

       ),
     );
  }

}